package com.museyu.model;

import java.util.ArrayList;
import java.util.List;

public class Player {
    private String id;
    private String name;
    private List<Card> cards;
    private boolean dealer;
    private boolean isCurrentPlayer;
    private int score;
    private boolean hasDrawn;
    private int points;

    public Player(String id, String name) {
        this.id = id;
        this.name = name;
        this.cards = new ArrayList<>();
        this.dealer = false;
        this.isCurrentPlayer = false;
        this.score = 0;
        this.hasDrawn = false;
        this.points = 0;
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public List<Card> getCards() {
        return cards;
    }

    public boolean isDealer() {
        return dealer;
    }

    public void setDealer(boolean dealer) {
        this.dealer = dealer;
    }

    public boolean isCurrentPlayer() {
        return isCurrentPlayer;
    }

    public void setCurrentPlayer(boolean currentPlayer) {
        isCurrentPlayer = currentPlayer;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public void addCard(Card card) {
        cards.add(card);
    }
    
    public void clearCards() {
        cards.clear();
    }
    
    public int getTotalPoints() {
        return cards.stream()
                .mapToInt(Card::getNumericValue)
                .sum();
    }

    public boolean hasDrawn() {
        return hasDrawn;
    }

    public void setHasDrawn(boolean hasDrawn) {
        this.hasDrawn = hasDrawn;
    }

    public int getPoints() {
        return points;
    }

    public void setPoints(int points) {
        this.points = points;
    }
} 